HTML - tags - td tag

revision:


Content

"td" tag : defines a data cell in a table syntax some examples


"td" tag : defines a data cell in a table

top

The <td> tag defines a standard data cell in an HTML table. An HTML table has two kinds of cells: header cells, which contain header information (created with the "th" element), and data cells, which contain data (created with the "td" element). The text in "td" elements is regular and left-aligned by default. The text in "th" elements is bold and centered by default.

Attributes: the <td> element supports the global attributes and events attributes.Specific attributes are:

colspan ; value: number;

specifies the number of columns a cell should span.

header ; value: header_id;

specifies one or more header cells a cell is related to.

rowspan ; value: number;

sets the number of rows a cell should span.


Syntax

top

<td> . . . </td>


some examples

top
Cell A Cell B
Cell C Cell D
Codes:
                  <style>
                      table, th, td {border: 1px solid black;margin-left:4vw;}
                  </style>
                  <table>
                      <tr>
                        <td>Cell A</td>
                        <td>Cell B</td>
                      </tr>
                      <tr>
                        <td>Cell C</td>
                        <td>Cell D</td>
                      </tr>
                    </table>
                    
              
Month Savings
January $100
Codes:
                  <table>
                      <tr>
                        <th>Month</th>
                        <th>Savings</th>
                      </tr>
                      <tr>
                        <td style="background-color:#FF0000">January</td>
                        <td style="background-color:#00FF00">$100</td>
                      </tr>
                    </table>